<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-paperdef-edit" >

			<div class="form-group">
			<label class="col-sm-3 control-label">试卷名称，如 2020年信息技术考试</label>
			<div class="col-sm-8">
				<input id="name" name="name" class="form-control" type="text">
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">科目：</label>
			<div class="col-sm-8">
				<select id="kmid"  name="kmid" class="form-control noselect2 selectpicker">
                	<option value=""> -- 请选择科目 -- </option>
                	<option th:each="km : ${kms}" th:value="${km.id}" th:text="${km.name}"></option>
                </select>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">试卷状态：off关闭,默认on允许下载考试</label>
			<div class="col-sm-8">
				<div class="onoffswitch">
					<input type="checkbox" checked class="onoffswitch-checkbox" id="status" name="status">
					<label class="onoffswitch-label" for="status">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">开始时间：</label>
			<div class="col-sm-8 input-group date">
				<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
				<input id="starttime" name="starttime"  class="form-control" type="text">
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">结束时间：</label>
			<div class="col-sm-8 input-group date">
				<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
				<input id="endtime" name="endtime" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">考试时长(分钟)：</label>
			<div class="col-sm-8">
				<input id="duration" name="duration" value="90" class="form-control" type="text">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">禁止交卷时长(分钟)：</label>
			<div class="col-sm-8">
				<input id="nojj" name="nojj" value="10" class="form-control" type="text">
			</div>
		</div>
<!-- 				<div class="form-group">
			<label class="col-sm-3 control-label">成绩公布时间：</label>
			<div class="col-sm-8 input-group date">
				<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
				<input id="showtime" name="showtime" class="form-control" type="text">
			</div>
		</div> -->
				<div class="form-group">
			<label class="col-sm-3 control-label">卷面总分：</label>
			<div class="col-sm-8">
				<input id="totalScore" name="totalScore" value="100" class="form-control" type="text">
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">及格分数：</label>
			<div class="col-sm-8">
				<input id="passScore" name="passScore" value="60" class="form-control" type="text">
			</div>
		</div>
<!-- 				<div class="form-group">
			<label class="col-sm-3 control-label">试题顺序off原始on随机：</label>
			<div class="col-sm-8">
				<div class="onoffswitch">
					<input type="checkbox" class="onoffswitch-checkbox" id="questionOrder" name="questionOrder">
					<label class="onoffswitch-label" for="questionOrder">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div> -->
				<div class="form-group">
			<label class="col-sm-3 control-label">试卷类型off固定on随机：</label>
			<div class="col-sm-8">				
				<div class="onoffswitch">
					<input type="checkbox" checked class="onoffswitch-checkbox" id="papertype" name="papertype">
					<label class="onoffswitch-label" for="papertype">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">公布答案off否on是：</label>
			<div class="col-sm-8">				
				<div class="onoffswitch">
					<input type="checkbox" class="onoffswitch-checkbox" id="showkey" name="showkey">
					<label class="onoffswitch-label" for="showkey">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">显示形式on整卷off单题：</label>
			<div class="col-sm-8">
				
				<div class="onoffswitch">
					<input type="checkbox" checked="true" class="onoffswitch-checkbox" id="showmode" name="showmode">
					<label class="onoffswitch-label" for="showmode">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">是否加密试卷off不加密on加密：</label>
			<div class="col-sm-8">				
				<div class="onoffswitch">
					<input type="checkbox"  class="onoffswitch-checkbox" id="isenc" name="isenc">
					<label class="onoffswitch-label" for="isenc">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">试卷说明：</label>
			<div class="col-sm-8">
				<input id="remark" name="remark" class="form-control" type="text">
			</div>
		</div>
<!-- 				<div class="form-group">
			<label class="col-sm-3 control-label">试卷模板：</label>
			<div class="col-sm-8">
				<input id="data" name="data"th:value="${paperdef.data}" class="form-control" type="text">
			</div>
		</div> -->
<div class="form-group">
			<label class="col-sm-3 control-label">任务类型1正式2模拟3自测：</label>
			<div class="col-sm-8">
				<input id="kstype" name="kstype" value="1" class="form-control" type="text">
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">是否限制考场：</label>
			<div class="col-sm-8">
				<div class="onoffswitch">
					<input type="checkbox" class="onoffswitch-checkbox" id="restip" name="restip">
					<label class="onoffswitch-label" for="restip">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div>
				<div class="form-group">
			<label class="col-sm-3 control-label">是否统一交卷时间：</label>
			<div class="col-sm-8">
				<div class="onoffswitch">
					<input type="checkbox" class="onoffswitch-checkbox" id="resttime" name="resttime">
					<label class="onoffswitch-label" for="resttime">
						<span class="onoffswitch-switch"></span>
						<span class="onoffswitch-inner"></span>
					</label>
				</div>
			</div>
		</div>		
		</form>
</div>
<div th:include="include::footer"></div>
<script type="text/javascript">
	var prefix = ctx + "exam/paperdef";
	$("#form-paperdef-edit").validate({
		onkeyup: false,
		rules:{
			name:{
				required:true
			},
			kmid:{
				required:true
			},
			starttime:{
				required:true
			},
			endtime:{
				required:true
			},
			duration:{
				required:true,
				digits:true
			},
			nojj:{
				required:true,
				digits:true
			},
			showtime:{
				required:true
			},
			totalScore:{
				required:true,
				digits:true
			},
			passScore:{
				required:true,
				digits:true
			},
			kstype:{
				required:true,
				digits:true
			}
		}
	});

	function submitHandler() {
		if ($.validate.form()) {
			$.operate.save(prefix + "/addDo", $('#form-paperdef-edit').serialize());
		}
	}
	function now(){
		return $.format.date(new Date(),"yyyy-MM-dd HH:mm");
	}
	$(function(){
		layui.use('laydate', function(){
     		  var laydate = layui.laydate;
     		 var startDate = laydate.render({ 
        		    elem: '#starttime',
        		    type: 'datetime',
    		        theme: 'molv',
    		        trigger: 'click',
    		        value: new Date(),//初始值
    		        done: function(value, date) {
    		            // 结束时间大于开始时间
    		            if (value !== '') {
    		                endDate.config.min.year = date.year;
    		                endDate.config.min.month = date.month - 1;
    		                endDate.config.min.date = date.date;
    		                endDate.config.min.hours = date.hours;
    		                endDate.config.min.minutes = date.minutes+1;
    		                endDate.config.min.seconds = date.seconds;
    		                //$("#title").val($.format.date(new Date(value),"yyyy-MM-dd HH:mm")+$("#title").val());
    		            } else {
    		                endDate.config.min.year = '';
    		                endDate.config.min.month = '';
    		                endDate.config.min.date = '';
    		                endDate.config.min.hours = '';
    		                endDate.config.min.minutes = '';
    		                endDate.config.min.seconds = '';
    		            }
    		        }
        		  });
     		var endDate = laydate.render({ 
    		    elem: '#endtime',
    		    type: 'datetime',
    		    min: $('#starttime').val(),
		        theme: 'molv',
		        trigger: 'click',
		        value: new Date(),
		        done: function(value, date) {
		            // 开始时间小于结束时间
		            if (value !== '') {
		                startDate.config.max.year = date.year;
		                startDate.config.max.month = date.month - 1;
		                startDate.config.max.date = date.date;
		                startDate.config.min.hours = date.hours;
		                startDate.config.min.minutes = date.minutes-1;
		                startDate.config.min.seconds = date.seconds;
		            } else {
		                startDate.config.max.year = '';
		                startDate.config.max.month = '';
		                startDate.config.max.date = '';
		                startDate.config.min.hours = '';
		                startDate.config.min.minutes = '';
		                startDate.config.min.seconds = '';
		            }
		        }
    		  });
     		laydate.render({ 
    		    elem: '#showtime',
    		    type: 'datetime',
    		    min: $('#endtime').val(),
		        theme: 'molv',
		        trigger: 'click',
		        value: new Date()
     		});
		})
	})	
</script>
</body>
</html>
